<?php
namespace Home\Controller;
use Think\Controller;
class UcenterController extends CommonController {
    public function index(){

    	$question = M('question')->where(array('uid'=>$_SESSION['id']))->select();

    	$count =  M('question')->where(array('uid'=>$_SESSION['id']))->count();

    	$countCollect =  M('store')->where(array('uid'=>$_SESSION['id']))->count();

    	$this->assign('count',$count);

    	$this->assign('countCollect',$countCollect);

    	$this->assign('question',$question);

    	$this->assign('title','个人资料');

        $this->display();
    }

    public function collect()
    {
    	$countCollect =  M('store')->where(array('uid'=>$_SESSION['id']))->count();

    	$count =  M('question')->where(array('uid'=>$_SESSION['id']))->count();

    	$sql = "select t1.title,t2.create_time from question t1 inner join store t2 on t1.id=t2.qid where t2.uid=".$_SESSION['id'];

    	$collect = M()->query($sql);

    	$this->assign('collect',$collect);

    	$this->assign('count',$count);

    	$this->assign('countCollect',$countCollect);

    	$this->display();
    }
}